package com.sslite.standalone;

import com.sslite.util.Utility;

public class OneTimeUseOnly {
	public static void main(String args[]) throws Exception{
		StringBuilder sb = new StringBuilder();
		
		String content = Utility.getContent( "file:/e:/All-Aggregate.html" );
		
		String SYMBOL_PATTERN = "<param name='chartTitle' value='";
		String SV0_PATTERN = "<param name='sampleValues_0' value='";
		String SV1_PATTERN = "<param name='sampleValues_1' value='";
		String SL_PATTERN = "<param name='sampleLabels' value='";
		String END_PATTERN = "'>";
		int indexOfSymbol = 0;
		while( (indexOfSymbol = content.indexOf(SYMBOL_PATTERN, indexOfSymbol+1)) != -1 ){
			String symbol = content.substring( indexOfSymbol + SYMBOL_PATTERN.length(), content.indexOf( END_PATTERN, indexOfSymbol ) );
			
			int indexOfSV0 = content.indexOf( SV0_PATTERN, indexOfSymbol );
			String sv0 = content.substring( indexOfSV0 + SV0_PATTERN.length(), content.indexOf(END_PATTERN, indexOfSV0));
			
			int indexOfSV1 = content.indexOf( SV1_PATTERN, indexOfSV0 );
			String sv1 = content.substring( indexOfSV1 + SV1_PATTERN.length(), content.indexOf(END_PATTERN, indexOfSV1));

			int indexOfSL = content.indexOf( SL_PATTERN, indexOfSV1 );
			String sl = content.substring( indexOfSL + SL_PATTERN.length(), content.indexOf(END_PATTERN, indexOfSL));
			
			System.out.println( symbol + ".sampleValues_0=" +sv0 );
			System.out.println( symbol + ".sampleValues_1=" +sv1 );
			System.out.println( symbol + ".sampleLabels=" +sl );

			sb.append( symbol + ".sampleValues_0=" +sv0 ).append("\n");
			sb.append( symbol + ".sampleValues_1=" +sv1 ).append("\n");
			sb.append( symbol + ".sampleLabels=" +sl ).append("\n");
		}
		Utility.saveContent("E:/lost_rpt.properties", sb.toString());
	}
}
